import { Switch } from "antd";
import { connect } from "react-redux";
import { setThemeConfig } from "@/redux/modules/global/action";

const SwitchHappy = (props: any) => {
	const { setThemeConfig, themeConfig } = props;
	const onChange = (checked: boolean) => {
		setThemeConfig({ ...themeConfig, isHappy: checked });
	};

	return <Switch className="dark" defaultChecked={themeConfig.isHappy} onChange={onChange} />;
};

const mapStateToProps = (state: any) => state.global;
const mapDispatchToProps = { setThemeConfig };
export default connect(mapStateToProps, mapDispatchToProps)(SwitchHappy);
